// src/APP.vue

<template>
  <input type="text" v-model="obj.name"> 
  <button @click="stopWatchEffect">停止监听</button>
</template>

<script lang="ts">
import {  defineComponent, reactive, watchEffect,  } from 'vue'

export default defineComponent({
  name: 'APP',
  setup() {
    let obj = reactive({
      name:'zs'
    });
    const stop = watchEffect(() => {
      console.log('name:',obj.name)
    })
    const stopWatchEffect = () => {
      console.log('停止监听')
      stop();
    }

    return {
      obj,
      stopWatchEffect,
    }
  }
})
</script>